/**
 * 
 */
package com.fruit.app.common.util;


/**
 * @Discription: 字符处理类
 * @ClassName: StringUtils
 *
 * @Author:[caiwei]
 * @Version 1.0
 * @Date 2012-5-18 下午3:41:59
 *
 */
public class StringUtils extends org.springframework.util.StringUtils {

	/**
	 * @Title: subString
	 * @Discription: 如果字符长度超过预计长度则截取，并添加省略号标记
	 *
	 * @Author:[caiwei]
	 * @Version 1.0
	 * @Date 2012-5-18 下午4:21:05
	 *
	 * @param str
	 * @param length
	 * @return
	 * @ReturnType: String
	 */
	public static String subString(String str, Integer length){
		if (hasText(str) && str.length() > length) {
			str = str.substring(0, length) + "...";
		}
		return str;
	}
	
}
